package com.haitun.risk.govern.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.haitun.risk.govern.dao.ReceiveInfoDao;
import com.haitun.risk.govern.model.AddressRestrict;
import com.haitun.risk.govern.model.CertificateRestrict;
import com.haitun.risk.govern.model.PhoneRestrict;
import com.haitun.risk.govern.model.ReceiveInfo;

@Repository
public class ReceiveInfoDaoImpl implements ReceiveInfoDao {

    @Autowired
    private SqlSessionTemplate sqlSessionTemplate;
    
	@Override
	public List<ReceiveInfo> findByReceiveInfo(ReceiveInfo receiveInfo) {
		return sqlSessionTemplate.selectList("findByReceiveInfo", receiveInfo);
	}

	@Override
	public void updateAmountByCertificate(CertificateRestrict certificateRestrict) {
		sqlSessionTemplate.insert("updateAmountByCertificate", certificateRestrict);
	}
	@Override
	public void updateAmountByPhone(PhoneRestrict phoneRestrict) {
		sqlSessionTemplate.insert("updateAmountByPhone", phoneRestrict);
	}
	@Override
	public void updateAmountByAddresss(AddressRestrict addressRestrict) {
		sqlSessionTemplate.insert("updateAmountByAddresss", addressRestrict);
	}

	@Override
	public CertificateRestrict getByCertificateAndYear(CertificateRestrict certificateRestrict) {
		return sqlSessionTemplate.selectOne("getByCertificateAndYear",certificateRestrict);
	}

	@Override
	public PhoneRestrict getByPhoneAndYear(PhoneRestrict phoneRestrict) {
		return sqlSessionTemplate.selectOne("getByPhoneAndYear",phoneRestrict);
	}

	@Override
	public AddressRestrict getByAddressAndYear(AddressRestrict addressRestrict) {
		return sqlSessionTemplate.selectOne("getByAddressAndYear",addressRestrict);
	}
	
}